#include "init.h"

#pragma once
class camera
{
public:

	camera(IDirect3DDevice9 *d3ddev, FLOAT fnear, FLOAT ffar);
	~camera();
	void initProjection(float fov, float aspect, float nearp, float farp);
	void SetYMove(bool move) { m_Ymove = move; };
	bool GetYMove() { return m_Ymove; };

	D3DXMATRIX* GetViewMatrix()        { return &matView; }
	D3DXMATRIX* GetProjectionMatrix()  { return &matLook; }
	D3DXVECTOR3* GetPosition()         { return &m_camPos; }
	D3DXVECTOR3* GetLookAt()           { return &m_lookAtPos; }
	D3DXVECTOR3* GetLook()           { return &m_lookPos; }

	void update();

	void moveForward(float aspect);
	void moveLR(FLOAT aspect);
	void moveUp(float aspect);

	void pitch(FLOAT aspect);
	void yaw(FLOAT aspect);
	void roll(FLOAT aspect);

	void RotateY(FLOAT amount);


private:

	bool m_Ymove;
	bool m_YPos; 

	IDirect3DDevice9* m_d3ddev;

	D3DXMATRIX matView;
	D3DXMATRIX matLook;

	D3DXVECTOR3 m_camPos;
	D3DXVECTOR3	m_lookPos;
	D3DXVECTOR3	m_lookAtPos;
	D3DXVECTOR3 m_right;
	D3DXVECTOR3	m_up;
	D3DXVECTOR3 m_speed;

	float m_yaw;  // rotation around the y axis
	float m_pitch; // rotation around the x axis
	float m_pitchlevel;
	float m_roll; // rotation around the z axis

	float maxspeed = 2.0f;

	float m_fov;
	float m_aspect;
	float m_near;
	float m_far;
};

